import React, { Component } from 'react';
import { WhiteSpace, List } from 'antd-mobile';
import { withRouter } from 'react-router-dom';
import YwxNavBar from '../../components/common/YwxNavBar/YwxNavBar';
import YwxButton from '../../components/common/YwxButton/YwxButton';

const Item = List.Item;

class Setting extends Component {

    onClick = () => {
        this.props.history.push('/modification')
    }
    exit = () => {
        React.$utils.request({
            url: '/app/logout',
            method: 'post'
        }).then(res => {
            this.props.history.push('/login')
        })
    }
    render() {
        return (
            <div className='setting'>
                <YwxNavBar>系统设置</YwxNavBar>
                <WhiteSpace />
                <List>
                    <Item
                        arrow='horizontal'
                        onClick={this.onClick}
                    >修改密码</Item>
                </List>
                <YwxButton style={{ marginTop: '1rem' }} onClick={this.exit}>退出登录</YwxButton>
            </div>
        );
    }
}

export default withRouter(Setting)